package fr.enseirb.mycub.structures;

import java.util.ArrayList;

import fr.enseirb.mycub.db.BikeDBConstants;
import fr.enseirb.mycub.db.TramwayDBConstants;

import android.database.Cursor;
import android.provider.BaseColumns;

public class Line {
	
	int id;
	private String name;
	ArrayList<SpecificLine> lines;

	public Line(){
	}


	public static ArrayList<Line> getLinesFromCursor(Cursor cursor){

		ArrayList<Line> lines = new ArrayList<Line>();

		if(cursor.getCount() == 0 ) return lines;

		int nameColumn = cursor
				.getColumnIndex(BikeDBConstants.KEY_NAME);

		int idColumn = cursor.getColumnIndex(BaseColumns._ID);

		cursor.moveToFirst();
		Line l = null;
		int size = cursor.getCount();
		for(int i =  0; i < size; i ++){
			l = new Line();
			l.id = cursor.getInt(idColumn);
			l.setName(cursor.getString(nameColumn));
			lines.add(l);
			cursor.moveToNext();
		}

		cursor.close();
		
		return lines;
	}


	public String getName() {
		return name;
	}


	public void setName(String name) {
		this.name = name;
	}
	
}
